/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package frmsystem.gui;

import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SpringLayout;

import frmsystem.IDomain;

/**
 *
 * @author bahria
 */
public class TransactionUI extends JDialog {

	protected SpringLayout layout = new SpringLayout();
	protected JTextField txtAccNo;
    protected JTextField txtAmount;
    protected JButton cmdOk;
    protected JButton cmdCancel;
    protected String party;
    
	public TransactionUI(String val, String party){
		this.party = party;
		getContentPane().setLayout(layout);
		JLabel lblAccNo = new JLabel("Account No");
    	getContentPane().add(lblAccNo);
    	layout.putConstraint(SpringLayout.WEST, lblAccNo, 10, SpringLayout.WEST, getContentPane());
        layout.putConstraint(SpringLayout.NORTH, lblAccNo, 10, SpringLayout.NORTH, getContentPane());
        
        txtAccNo = new JTextField(10);
        txtAccNo.setText(val);
        getContentPane().add(txtAccNo);
        layout.putConstraint(SpringLayout.WEST, txtAccNo, 10, SpringLayout.EAST, lblAccNo);
        layout.putConstraint(SpringLayout.NORTH, txtAccNo, 0, SpringLayout.NORTH, lblAccNo);
        
        JLabel lblAmount = new JLabel("Amount:");
    	getContentPane().add(lblAmount);
    	layout.putConstraint(SpringLayout.WEST, lblAmount, 0, SpringLayout.WEST, lblAccNo);
        layout.putConstraint(SpringLayout.NORTH, lblAmount, 10, SpringLayout.SOUTH, lblAccNo);
        
        txtAmount = new JTextField(10);
        getContentPane().add(txtAmount);
        layout.putConstraint(SpringLayout.WEST, txtAmount, 0, SpringLayout.WEST, txtAccNo);
        layout.putConstraint(SpringLayout.NORTH, txtAmount, 0, SpringLayout.NORTH, lblAmount);
        
        cmdOk = new JButton("Ok");
        getContentPane().add(cmdOk);
        layout.putConstraint(SpringLayout.WEST, cmdOk, 30, SpringLayout.WEST, getContentPane());
        layout.putConstraint(SpringLayout.NORTH, cmdOk, 20, SpringLayout.SOUTH, lblAmount);
        
        cmdCancel = new JButton("Cancel");
        getContentPane().add(cmdCancel);
        layout.putConstraint(SpringLayout.WEST, cmdCancel, 20, SpringLayout.EAST, cmdOk);
        layout.putConstraint(SpringLayout.NORTH, cmdCancel, 0, SpringLayout.NORTH, cmdOk);
        
        setSize(250, 150);
        setModal(true);
	}
	
	public void addOkActionListener(ActionListener al){
		cmdOk.addActionListener(al);
	}
	
	public void addCancelActionListener(ActionListener al){
		cmdCancel.addActionListener(al);
	}

	public JTextField getTxtAccNo() {
		return txtAccNo;
	}

	public JTextField getTxtAmount() {
		return txtAmount;
	}

	public String getParty() {
		return party;
	}
	
	
    
}
